home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM B4 / PD-ROM B4.iso / Entertainment / Strategy / Robots / bot 1.0.1 / Tutorial / ASM / Seeker < prev    next >
Text File  |  1991-07-19  |  921b  |  34 lines

  1. !
  2. ! Seeker
  3. !
  4. ! This bot scans around in a circle until it finds another bot.
  5. ! It locks on to the bot, firing until the enemy bot leaves the
  6. ! arc of the scanner.  Then it resumes scanning.
  7.  
  8. #DATA
  9.  
  10. DEF SCAN_AT             ! Current scan angle
  11. EQU INCREMENT 11        ! Amount to add to scan angle each time
  12.  
  13. #CODE ASM
  14.  
  15. :INITIALIZE
  16.     RND 360, SCAN_AT    ! Start at a random angle
  17.  
  18. :SCANLOOP
  19.     ADD INCREMENT, SCAN_AT
  20.     SCN SCAN_AT
  21.     CMP S0, 0           ! S0 == 0 means that nothing was found
  22.     BEQ SCANLOOP        ! ... so continue around in a circle
  23.                         ! ... otherwise, go on to SCANLOCK
  24. :SCANLOCK
  25.     MOV S1, R1          ! Tell the weapon what angle to fire at
  26.     FIR 1               ! Fire weapon
  27.     SCN SCAN_AT         ! Check to see if enemy is still there
  28.     CMP S0, 0
  29.     BEQ SCANLOOP        ! If not, resume scanning
  30.     JMP SCANLOCK        ! If so, keep firing until he dies or
  31.                         !   moves.
  32.  
  33. #END
  34.